path_daas="V2.7"
path_daascloud="daas-v2.7"
path_tapdataweb="daas-v2.7"
path_tapdata_enterprise_web="develop-v2.7.0"
#rm -rf  ~/.local/share/.tapdata
#cd /root/daas/daas/
#git fetch --all && git reset --hard origin/$path_daas && git pull
#git pull
#cd /root/daas/daas-cloud
#git fetch --all && git reset --hard origin/$path_daascloud && git pull
#git pull
#cd /root/daas/tapdata-web
#git fetch --all && git reset --hard origin/$path_tapdataweb && git pull
#cd /root/daas/pdkgithub/tapdata
#git pull
#cd /root/daas/pdkgithub/tapdata-enterprise-web
#git fetch --all && git reset --hard origin/$path_tapdata_enterprise_web && git pull
#git pull
#sed -i 's/localhost:3000/192.168.0.13:3001/' /root/daas/pdkgithub/tapdata-enterprise-web/apps/daas/vue.config.js

##PDK
#cd  /root/daas/pdkgithub/tapdata
#git pull
#mvn clean install -U  -DskipTests
all_plugins="connectors/dist/activemq-connector-v1.0-SNAPSHOT.jar connectors/dist/kafka-connector-v1.0-SNAPSHOT.jar connectors/dist/rabbitmq-connector-v1.0-SNAPSHOT.jar connectors/dist/rocketmq-connector-v1.0-SNAPSHOT.jar connectors/dist/clickhouse-connector-v1.0-SNAPSHOT.jar connectors/dist/doris-connector-v1.0-SNAPSHOT.jar connectors/dist/postgres-connector-v1.0-SNAPSHOT.jar connectors/dist/mysql-connector-v1.0-SNAPSHOT.jar connectors/dist/mongodb-connector-v1.0-SNAPSHOT.jar connectors/dist/elasticsearch-connector-v1.0-SNAPSHOT.jar connectors/dist/dummy-connector-v1.0-SNAPSHOT.jar connectors/dist/oceanbase-connector-v1.0-SNAPSHOT.jar"
#cd /root/daas/pdkgithub/tapdata
#./plugin-kit/bin/pdk  register -a 3324cfdf-7d3e-4792-bd32-571638d4562f -t http://localhost:3037 $all_plugins
#./plugin-kit/bin/pdk  register -a 3324cfdf-7d3e-4792-bd32-571638d4562f -t http://localhost:8082 $all_plugins
#./plugin-kit/bin/pdk  register -a 3324cfdf-7d3e-4792-bd32-571638d4562f -t http://192.168.1.132:31321 $all_plugins
#./plugin-kit/bin/pdk register -a 3324cfdf-7d3e-4792-bd32-571638d4562f -t http://localhost:30513 $all_plugins
#./plugin-kit/bin/pdk register -a 3324cfdf-7d3e-4792-bd32-571638d4562f -t http://192.168.1.132:31787 $all_plugins
#./plugin-kit/bin/pdk register -a 3324cfdf-7d3e-4792-bd32-571638d4562f -t http://192.168.1.132:31267 $all_plugins
#./plugin-kit/bin/pdk register -a 3324cfdf-7d3e-4792-bd32-571638d4562f -t http://192.168.1.132:31473  $all_plugins

#./plugin-kit/bin/pdk modelPrediction -m /root/tools/apache-maven-3.6.3 -o ./output connectors/mysql/mysql-connector connectors/postgres/postgres-connector connectors/mongodb-connector connectors/oracle-connector


#cd /root/daas/pdkgithub/tapdata/manager
#mvn clean install -U  -DskipTests -P not_encrypt
#cd /root/daas/pdkgithub/tapdata/plugin-kit
#mvn clean install -U -DskipTests -P not_encrypt
#cd /root/daas/pdkgithub/tapdata/iengine
#mvn clean package  -U -DskipTests -P not_encrypt

#ps -ef|grep /root/daas/jar | grep tm-0.0.1 |grep -v grep|awk  '{print "kill -9 " $2}' |sh
#sleep 2
#ps -ef|grep /root/daas/jar | grep connector-manager |grep -v grep|awk  '{print "kill -9 " $2}' |sh
#sleep 2
ps -ef|grep /root/daas/jar | grep jacoco |grep -v grep|awk  '{print "kill -9 " $2}' |sh
#sleep 2
ps -ef|grep /root/daas/tapdata-web |grep -v grep|awk  '{print "kill -9 " $2}' |sh
ps -ef|grep /root/daas/pdkgithub/tapdata-enterprise-web |grep -v grep|awk  '{print "kill -9 " $2}' |sh
sleep 2
#ps -ef|grep /root/daas/jar |grep -v grep|awk  '{print "kill -9 " $2}' |sh
#sleep 2

for i in `lsof -i:3001 | awk '{print $2}' | grep -v 'PID'`;do kill -9 $i;done
sleep 2

for i in `lsof -i:8082 | awk '{print $2}' | grep -v 'PID'`;do kill -9 $i;done
sleep 2

#cd /root/daas/daas/backend
#npm i
#node run_init.js 'DAAS' 'all' 'false' 'mongodb://root:tapdata@192.168.0.30:32000/tapdatagithub?authSource=admin'

#rm -rf /root/daas/daas/connector/connector-manager.jar
#rm -rf /root/daas/daas-cloud/tm/tm/target/tm-0.0.1.jar

#rm -rf  /root/daas/jar/connector-manager.jar
#rm -rf /root/daas/jar/tm-0.0.1.jar

#cp /root/daas/daas/connector/connector-manager.jar  /root/daas/jar
#cp /root/daas/daas-cloud/tm/tm/target/tm-0.0.1.jar /root/daas/jar

scp /root/daas/pdkgithub/tapdata/iengine/ie.jar test-005:/root/daas/jar/test_admin
scp /root/daas/pdkgithub/tapdata/manager/tm/target/tm-0.0.1-SNAPSHOT.jar  test-005:/root/daas/jar/test_admin

scp /root/daas/pdkgithub/tapdata/iengine/ie.jar test-007:/root/daas/jar/test_admin
scp /root/daas/pdkgithub/tapdata/manager/tm/target/tm-0.0.1-SNAPSHOT.jar  test-007:/root/daas/jar/test_admin


#ssh test-005 > /dev/null 2>&1 << eeooff
#nohup bash /root/daas/jar/deploy_no_build.sh &
#exit
#eeooff
echo sshdone!
#cd /root/daas/jar
#nohup java -jar -Dserver.port=3001 -Dspring.data.mongodb.uri=mongodb://root:tapdata@192.168.0.30:32000/pdklocal?authSource=admin -server -Xms2g -Xmx3g tm-*.jar > tm.log  2&>1 &
#nohup java -javaagent:jacocoagent.jar=includes=*,output=tcpserver,port=9102,address=127.0.0.1  -jar -Dserver.port=3001 -Dspring.data.mongodb.uri=mongodb://root:tapdata@192.168.0.30:32000/pdklocal?authSource=admin -server -Xms1g -Xmx1g /root/daas/jar/tm-*.jar > /root/daas/jar/tm.log  2&>1  &
#java -javaagent:jacocoagent.jar=includes=*,output=tcpserver,port=9101,address=127.0.0.1 -jar -Dserver.port=3001 -Dspring.data.mongodb.uri=mongodb://root:tapdata@192.168.0.30:32000/manager?authSource=admin -server -Xms1g -Xmx1g /root/daas/daas-cloud/tm/tm/target/tm-*.jar

#export app_type=DAAS; export backend_url=http://127.0.0.1:3001/api/; export TAPDATA_MONGO_URI=mongodb://root:tapdata@192.168.0.30:32000/pdklocal?authSource=admin;
#nohup java -jar connector-manager.jar &
#nohup java -javaagent:jacocoagent.jar=includes=*,output=tcpserver,port=9101,address=127.0.0.1 -jar /root/daas/jar/connector-manager.jar fe.log 2&>1  &

#npm install -g pnpm
cd /root/daas/pdkgithub/tapdata-enterprise-web
nohup pnpm i &
sleep 20
cd /root/daas/pdkgithub/tapdata-enterprise-web/apps/daas
nohup pnpm start:dev -- --port=8082 &

#######API######
for i in `lsof -i:3080 | awk '{print $2}' | grep -v 'PID'`;do kill -9 $i;done
for i in `lsof -i:3080 | awk '{print $2}' | grep -v 'PID'`;do kill -9 $i;done
for i in `lsof -i:9101 | awk '{print $2}' | grep -v 'PID'`;do kill -9 $i;done
for i in `lsof -i:9102 | awk '{print $2}' | grep -v 'PID'`;do kill -9 $i;done

cd /root/daas/tapdata-enterprise/apiserver
npm config set registry https://registry.npm.taobao.org/
npm i
npm run build
export TAPDATA_PORT=3001
# TM 端口 地址
export TAPDATA_HOST=192.168.0.13
nohup node index &

#nohup bash /root/daas/pdk/idaas-pdk/buildpdk.sh &
#nohup bash /root/daas/idaas-pdk/buildpdk.sh &

cd /root/daas/pdkgithub/tapdata
./plugin-kit/bin/pdk  register -a 3324cfdf-7d3e-4792-bd32-571638d4562f -t http://localhost:8082 $all_plugins
#./plugin-kit/bin/pdk  register -a 3324cfdf-7d3e-4792-bd32-571638d4562f -t http://192.168.1.132:31321 $all_plugins
#./plugin-kit/bin/pdk register -a 3324cfdf-7d3e-4792-bd32-571638d4562f -t http://localhost:30513 $all_plugins
